<template>
  <view class="pay-success">
    <uni-icons type="checkbox" size="80" color="#c61323"></uni-icons>
    <view class="pay-success-tip">支付成功</view>
    <view class="pay-success-pay-way">
      <label>支付方式：</label>
      <label>微信支付</label>
    </view>
    <view class="pay-success-pay-sum">
      <label>支付金额：</label>
      <label>¥{{ payPrice }}</label>
    </view>
    <view class="pay-success-btn">
      <view class="pay-success-btn-order" @click="lookOrderClick">查看订单</view>
      <view class="pay-success-btn-home" @click="backHome">回到首页</view>
    </view>
  </view>
</template>

<script setup>
  import { onLoad } from '@dcloudio/uni-app';

  const payPrice = ref(0);
  onLoad((options) => {
    payPrice.value = options.payPrice || 0;
  });

  const backHome = () => {
    uni.switchTab({
      url: '/pages/index/mall',
    });
  };

  const lookOrderClick = () => {
    const pages = getCurrentPages();
    console.log('pages', pages);
    uni.navigateBack({
      delta: 3,
    });
    uni.navigateTo({
      url: '/pages/order/index',
    });
  };
</script>

<style scoped lang="scss">
  .pay-success {
    margin: 24rpx 24rpx 0rpx 24rpx;
    width: 688rpx;
    border-radius: 16rpx;
    background: #ffffff;
    display: flex;
    flex-direction: column;
    padding: 160rpx 0rpx;
    align-items: center;
    .pay-success-tip {
      margin-top: 32rpx;
      color: #202020;
      font-family: PingFang SC;
      font-weight: 600;
      font-size: 36rpx;
      line-height: 48rpx;
    }
    .pay-success-pay-way {
      margin-top: 32rpx;
      display: flex;
      align-items: center;
      color: #545567;
      font-family: PingFang SC;
      font-size: 24rpx;
    }
    .pay-success-pay-sum {
      margin-top: 8rpx;
      display: flex;
      align-items: center;
      color: #545567;
      font-family: PingFang SC;
      font-size: 24rpx;
    }
    .pay-success-btn {
      margin-top: 80rpx;
      display: flex;
      align-items: center;
      .pay-success-btn-order {
        width: 224rpx;
        padding: 16rpx 0rpx;
        border-radius: 56rpx;
        border: 1rpx solid #a5a5be;
        box-sizing: border-box;
        background: #ffffff;
        display: flex;
        align-items: center;
        justify-content: center;
        color: #202020;
        font-family: PingFang SC;
        font-weight: 600;
        font-size: 28rpx;
        margin-right: 16rpx;
      }
      .pay-success-btn-home {
        width: 224rpx;
        padding: 16rpx 0rpx;
        border-radius: 56rpx;
        box-sizing: border-box;
        background: #c61323;
        display: flex;
        align-items: center;
        justify-content: center;
        color: #ffffff;
        font-family: PingFang SC;
        font-weight: 600;
        font-size: 28rpx;
        margin-left: 16rpx;
      }
    }
  }
</style>
